<?php
namespace app\admin\validate;
use think\Validate;
class Admins extends Validate{

    // 验证规则
    protected $rule = [

        ['username', 'require|min:5', '请填写帐号|昵称不能短于5个字符'],
        ['password', 'require', '请输入密码'],
        ['cpassword', 'require|confirm:password', '请先确认密码|两次密码输入不一致'],
        ['chkcode', 'require', '请填写验证码'],
        ['is_use', 'require|number', '请选择是否启用用户|非法请求'],
        ['role_id', 'require|array', '请选择用户角色|非法请求'],
        
    ];
    
     protected $scene = [
        'login'  =>  ['username','password','chkcode'],
        'add'  =>  ['username','password','cpassword','is_use','role_id'],
        'edit'  =>  ['username','is_use','role_id'],
        'pwd'  =>  ['password','cpassword'],
    ];

      
}